<?php if ($data['act'] == 'detail'):
$os = OsEnvironments::getDataByIdFrontEnd($data['detail']['os_environment_id']);?>
<article class="detail">
	<?php if(isset($data['detail']) && count($data['detail'])):?>
		<h4><em><?php echo $os['OsEnvironmentsI18n'][SysLanguages::getCurrentLang()]['name']?></em></h4>
		<h1><?php echo $data['detail']['ProductsI18n'][SysLanguages::getCurrentLang()]['name']?></h1>
			<?php if (!empty($data['detail']['photo_url'])):?>
		<img src="<?php echo $data['detail']['photo_url']?>" title="<?php echo $data['detail']['ProductsI18n'][$sf_user->getCulture()]['name']?>" alt="<?php echo $data['detail']['ProductsI18n'][SysLanguages::getCurrentLang()]['name']?>"/>
		<h6><?php echo $data['detail']['ProductsI18n'][$sf_user->getCulture()]['name']?></h6>
		<?php endif?>
		<div class="pro-order"><span class="money-show"><?php echo $data['detail']['price']?></span>&#8363;<a class="button right" href="#" title="<?php echo $data['detail']['ProductsI18n'][SysLanguages::getCurrentLang()]['name']?>" alt="<?php echo $data['detail']['ProductsI18n'][SysLanguages::getCurrentLang()]['name']?>">Mua hàng</a></div>
		<br/>
		<div class="content">
			<?php echo html_entity_decode($data['detail']['ProductsI18n'][SysLanguages::getCurrentLang()]['content'])?>
		</div>
		
		<?php if(!empty($data['detail']['video_url'])):?>
		<div class="trailer">
			<h1>Video sản phẩm</h1>
			<div id="hz-trailer" class="hz-video" data-video-url="<?php echo html_entity_decode($data['detail']['video_url'])?>" data-photo-url="<?php echo $data['detail']['photo_url']?>" data-width="640" data-height="400"></div>
		</div>
		<br/>
		<?php endif;
		if(intval($data['detail']['album_id'])>0):
		$galleries = Galleries::getDataListFrontEnd(array('filter_gallery_album_id' =>intval($data['detail']['album_id'])));
		?>
		<div class="album">
			<h1>Hình ảnh sản phẩm</h1>
			<div class="slide">
			<?php foreach($galleries as $gl):?>
			<img src="<?php echo $gl['photo_url']?>" title="<?php echo $gl['title']?>"/>
			<?php endforeach;?>
			</div>
		</div>
		<?php endif?>
	<?php else:	?>
	<script type="text/javascript">
	window.location = '<?php echo url_for2('product')?>';
	</script>
	<?php endif;?>
</article>
<div class="clr"></div>
<?php if (intval($data['pagination']['total']) > 0):?>
<aside class="left">
	<div class="bar-title">
		<h1 class="right">Sản phẩm liên quan</h1>
	</div>
	<div>
		<?php include_component('componentUlti', 'product', array('act' => 'ref', 'id' => $data['detail']['id'], 'cate_id' => $data['detail']['cate_id'], 'page' => 1))?>
	</div>
</aside>
<div class="clr"></div>
<?php endif;
else: 
 $count_for = 0;
$perpage = intval($data['perpage']);
foreach($data['products'] as $pr){

	$item = array(
		'name'			=> $pr['ProductsI18n'][0]['name'],
		'photo_url'		=> $pr['photo_url'],
		'price'			=> $pr['price'],
		'id'			=> $pr['id'],
		'description' 	=> $pr['ProductsI18n'][0]['description'],
		'clear'			=> (++$count_for % $perpage == 0? htmlentities('<div class="clr"></div>'): ''),
		'href'			=> url_for2('product_detail', array('cate_id' => $pr['cate_id'],'id' => $pr['id'], 'title' => UserStringHelper::titleToAddress($pr['name'])))
	);
	
	include_component('componentUlti', 'productItem',array('data' => $item));
}?>
<div class="clr"></div>

<?php include_component('componentUlti', 'pagination',$data['pagination']);?>
<div class="clr"></div>
<?php endif;?>